/* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Availability-Group
高可用组的接口

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/

#import <Foundation/Foundation.h>
#import <JDCloudOCSDKAg/AgApiModel.h>


@implementation AgSetInstanceTemplateRequest
-(id) initWithRegion:(NSString *)regionId
instanceTemplateId:(NSString*)instanceTemplateId
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.instanceTemplateId = instanceTemplateId;
    self.agId = agId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
instanceTemplateId:(NSString*)instanceTemplateId
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.version = version;
    self.instanceTemplateId = instanceTemplateId;
    self.agId = agId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self instanceTemplateId])
    {
        [result setValue:[self instanceTemplateId] forKey:@"instanceTemplateId"];
    }
    if([self agId])
    {
        [result setValue:[self agId] forKey:@"agId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceTemplateId = [dictionary objectForKey:@"instanceTemplateId"];
    self.agId = [dictionary objectForKey:@"agId"];
    return self;
} 

@end
@implementation AgUpdateAgRequest
-(id) initWithRegion:(NSString *)regionId
descriptionValue:(NSString*)descriptionValue
name:(NSString*)name
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.descriptionValue = descriptionValue;
    self.name = name;
    self.agId = agId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
descriptionValue:(NSString*)descriptionValue
name:(NSString*)name
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.version = version;
    self.descriptionValue = descriptionValue;
    self.name = name;
    self.agId = agId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self descriptionValue])
    {
        [result setValue:[self descriptionValue] forKey:@"description"];
    }
    if([self name])
    {
        [result setValue:[self name] forKey:@"name"];
    }
    if([self agId])
    {
        [result setValue:[self agId] forKey:@"agId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.descriptionValue = [dictionary objectForKey:@"description"];
    self.name = [dictionary objectForKey:@"name"];
    self.agId = [dictionary objectForKey:@"agId"];
    return self;
} 

@end
@implementation AgCreateAgRequest
-(id) initWithRegion:(NSString *)regionId
azs:(NSArray<NSString*>*)azs
agName:(NSString*)agName
agType:(NSString*)agType
instanceTemplateId:(NSString*)instanceTemplateId
descriptionValue:(NSString*)descriptionValue { 
    self.regionId = regionId;
    self.azs = azs;
    self.agName = agName;
    self.agType = agType;
    self.instanceTemplateId = instanceTemplateId;
    self.descriptionValue = descriptionValue;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
azs:(NSArray<NSString*>*)azs
agName:(NSString*)agName
agType:(NSString*)agType
instanceTemplateId:(NSString*)instanceTemplateId
descriptionValue:(NSString*)descriptionValue { 
    self.regionId = regionId;
    self.version = version;
    self.azs = azs;
    self.agName = agName;
    self.agType = agType;
    self.instanceTemplateId = instanceTemplateId;
    self.descriptionValue = descriptionValue;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self azs])
    {
        [result setValue:[self azs] forKey:@"azs"];
    }
    if([self agName])
    {
        [result setValue:[self agName] forKey:@"agName"];
    }
    if([self agType])
    {
        [result setValue:[self agType] forKey:@"agType"];
    }
    if([self instanceTemplateId])
    {
        [result setValue:[self instanceTemplateId] forKey:@"instanceTemplateId"];
    }
    if([self descriptionValue])
    {
        [result setValue:[self descriptionValue] forKey:@"description"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.azs = [dictionary objectForKey:@"azs"];
    self.agName = [dictionary objectForKey:@"agName"];
    self.agType = [dictionary objectForKey:@"agType"];
    self.instanceTemplateId = [dictionary objectForKey:@"instanceTemplateId"];
    self.descriptionValue = [dictionary objectForKey:@"description"];
    return self;
} 

@end
@implementation AgDeleteAgRequest
-(id) initWithRegion:(NSString *)regionId
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.agId = agId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.version = version;
    self.agId = agId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self agId])
    {
        [result setValue:[self agId] forKey:@"agId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.agId = [dictionary objectForKey:@"agId"];
    return self;
} 

@end
@implementation AgCreateAgResult
-(id) initWithAgId:(NSString*) agId { 
    self.agId = agId;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self agId])
    {
        [result setValue:[self agId] forKey:@"agId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.agId = [dictionary objectForKey:@"agId"];
    return self;
} 

@end
@implementation AgDescribeAgRequest
-(id) initWithRegion:(NSString *)regionId
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.agId = agId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.version = version;
    self.agId = agId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self agId])
    {
        [result setValue:[self agId] forKey:@"agId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.agId = [dictionary objectForKey:@"agId"];
    return self;
} 

@end
@implementation AgAbandonInstancesRequest
-(id) initWithRegion:(NSString *)regionId
instanceIds:(NSArray<NSString*>*)instanceIds
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.instanceIds = instanceIds;
    self.agId = agId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
instanceIds:(NSArray<NSString*>*)instanceIds
agId:(NSString*)agId { 
    self.regionId = regionId;
    self.version = version;
    self.instanceIds = instanceIds;
    self.agId = agId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self instanceIds])
    {
        [result setValue:[self instanceIds] forKey:@"instanceIds"];
    }
    if([self agId])
    {
        [result setValue:[self agId] forKey:@"agId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceIds = [dictionary objectForKey:@"instanceIds"];
    self.agId = [dictionary objectForKey:@"agId"];
    return self;
} 

@end
@implementation AgDescribeQuotasResult
-(id) initWithQuotas:(NSArray<AgQuota*>*) quotas { 
    self.quotas = quotas;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self quotas])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self quotas] count]; i++) {
            AgQuota* item = [[self quotas] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"quotas"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    NSArray* quotasArray = [dictionary objectForKey:@"quotas"];
    if(quotasArray&&![quotasArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [quotasArray count];i++)
        {
        AgQuota* item = [[AgQuota alloc]initWithDic:[quotasArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.quotas = propertyArray;
    }
    return self;
} 

@end
  
@implementation AgDescribeQuotasResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgDescribeQuotasResult* result = [[AgDescribeQuotasResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgDescribeQuotasResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation AgDescribeQuotasRequest
-(id) initWithRegion:(NSString *)regionId
filters:(NSArray<Filter*>*)filters { 
    self.regionId = regionId;
    self.filters = filters;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
filters:(NSArray<Filter*>*)filters { 
    self.regionId = regionId;
    self.version = version;
    self.filters = filters;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self filters])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self filters] count]; i++) {
            Filter* item = [[self filters] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"filters"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    NSArray* filtersArray = [dictionary objectForKey:@"filters"];
    if(filtersArray&&![filtersArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [filtersArray count];i++)
        {
        Filter* item = [[Filter alloc]initWithDic:[filtersArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.filters = propertyArray;
    }
    return self;
} 

@end
@implementation AgSetInstanceTemplateResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
  
@implementation AgSetInstanceTemplateResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgSetInstanceTemplateResult* result = [[AgSetInstanceTemplateResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgSetInstanceTemplateResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation AgAbandonInstancesResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
@implementation AgUpdateAgResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
  
@implementation AgUpdateAgResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgUpdateAgResult* result = [[AgUpdateAgResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgUpdateAgResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
  
@implementation AgAbandonInstancesResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgAbandonInstancesResult* result = [[AgAbandonInstancesResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgAbandonInstancesResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation AgDescribeAgsResult
-(id) initWithAgs:(NSArray<AvailabilityGroup*>*) ags
        totalCount:(NSNumber*)totalCount { 
    self.ags = ags;               
    self.totalCount = totalCount;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self ags])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self ags] count]; i++) {
            AvailabilityGroup* item = [[self ags] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"ags"];
    }
    if([self totalCount])
    {
        [result setValue:[self totalCount] forKey:@"totalCount"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    NSArray* agsArray = [dictionary objectForKey:@"ags"];
    if(agsArray&&![agsArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [agsArray count];i++)
        {
        AvailabilityGroup* item = [[AvailabilityGroup alloc]initWithDic:[agsArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.ags = propertyArray;
    }
    self.totalCount = [dictionary objectForKey:@"totalCount"];
    return self;
} 

@end
  
@implementation AgDescribeAgsResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgDescribeAgsResult* result = [[AgDescribeAgsResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgDescribeAgsResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
  
@implementation AgCreateAgResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgCreateAgResult* result = [[AgCreateAgResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgCreateAgResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation AgDescribeAgResult
-(id) initWithAg:(AvailabilityGroup*) ag { 
    self.ag = ag;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self ag])
    {
        [result setValue:[[self ag] dictionary]forKey:@"ag"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.ag = [[AvailabilityGroup alloc]initWithDic:[dictionary objectForKey:@"ag"]];
    return self;
} 

@end
  
@implementation AgDescribeAgResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgDescribeAgResult* result = [[AgDescribeAgResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgDescribeAgResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation AgDeleteAgResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
  
@implementation AgDeleteAgResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
AgDeleteAgResult* result = [[AgDeleteAgResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(AgDeleteAgResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation AgDescribeAgsRequest
-(id) initWithRegion:(NSString *)regionId
pageNumber:(NSNumber*)pageNumber
pageSize:(NSNumber*)pageSize
filters:(NSArray<Filter*>*)filters { 
    self.regionId = regionId;
    self.pageNumber = pageNumber;
    self.pageSize = pageSize;
    self.filters = filters;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
pageNumber:(NSNumber*)pageNumber
pageSize:(NSNumber*)pageSize
filters:(NSArray<Filter*>*)filters { 
    self.regionId = regionId;
    self.version = version;
    self.pageNumber = pageNumber;
    self.pageSize = pageSize;
    self.filters = filters;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self pageNumber])
    {
        [result setValue:[self pageNumber] forKey:@"pageNumber"];
    }
    if([self pageSize])
    {
        [result setValue:[self pageSize] forKey:@"pageSize"];
    }
    if([self filters])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self filters] count]; i++) {
            Filter* item = [[self filters] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"filters"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.pageNumber = [dictionary objectForKey:@"pageNumber"];
    self.pageSize = [dictionary objectForKey:@"pageSize"];
    NSArray* filtersArray = [dictionary objectForKey:@"filters"];
    if(filtersArray&&![filtersArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [filtersArray count];i++)
        {
        Filter* item = [[Filter alloc]initWithDic:[filtersArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.filters = propertyArray;
    }
    return self;
} 

@end
 
